public class SeekStringAndNextString {
    public static int strStr(String haystack, String needle) {
        int count=needle.length();
        for(int i=0;i<haystack.length()-count+1;i++){
            if(haystack.charAt(i)==needle.charAt(0)){
                String s=haystack.substring(i,i+count);
                if(s.equals(needle)){
                    return i;
                }
            }
        }
        return -1;
    }

    public static void main(String[] args) {
        String s="abc";
        String s1="bc";
        int i=strStr(s,s1);
        System.out.println(i);
    }
}
